<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
    <meta content=always name=referrer>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/base.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/base_user.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/bg.css">
    <script src="__STATIC__/js/swiper.min.js"></script>
    <script src="__STATIC__/js/jquery-1.8.2.js"></script>

    <title>首页</title>

    <script type="text/javascript">
        $(function(){

            $(".font_inner").find('li:first').clone(true).appendTo($(".font_inner"));//克隆第一个放到最后(实现无缝滚动)
            var liHeight = $(".swiper_wrap").height();//一个li的高度
            //获取li的总高度再减去一个li的高度(再减一个Li是因为克隆了多出了一个Li的高度)
            var totalHeight = ($(".font_inner li").length *  $(".font_inner li").eq(0).height()) -liHeight;
            $(".font_inner").height(totalHeight);//给ul赋值高度
            var index = 0;
            var autoTimer = 0;//全局变量目的实现左右点击同步
            var clickEndFlag = true; //设置每张走完才能再点击
            function tab(){
                $(".font_inner").stop().animate({
                    top: -index * liHeight
                },400,function(){
                    clickEndFlag = true;//图片走完才会true
                    if(index == $(".font_inner li").length -1) {
                        $(".font_inner").css({top:0});
                        index = 0;
                    }
                })
            }

            function next() {
                index++;
                tab();
            }
            function prev() {
                index--;
                if(index < 0) {
                    index = $(".font_inner li").size() - 2;//因为index的0 == 第一个Li，减二是因为一开始就克隆了一个LI在尾部也就是多出了一个Li，减二也就是_index = Li的长度减二
                    $(".font_inner").css("top",- ($(".font_inner li").size() -1) * liHeight);//当_index为-1时执行这条，也就是走到li的最后一个
                }
                tab();
            }
            //自动轮播
            autoTimer = setInterval(next,1000);
            $(".font_inner li").hover(function(){
                clearInterval(autoTimer);
            },function() {
                autoTimer = setInterval(next,1000);
            })

        })

    </script>
    <style>
        .layui-m-layercont{
            padding: 15px 0;
        }
        .share_list>li{
            width:33.3%;
            float: left;
            padding-bottom: 10px;
            text-align: center;
        }
        .share_img{
            width:50%;
        }
    </style>
</head>
<body onload="test()">
<div class="wrap-index">
    <!--banner开始-->
    <div class="swiper-container" style="padding-bottom: 0">
        <div class="swiper-wrapper">
            {volist name="banner_list" id="v"}
            <div class="swiper-slide">
                <a {if condition="$v.skip_type eq 'url'"} href="{$v.linkUrl}" {else/} {if condition="$v.skip_type eq 'shop'"} href="javascript:jump_shop({$v.linkUrl});" {else/} href="javascript:jump_goods_details({$v.linkUrl});" {/if}{/if}>
                <img src="/{$v.picUrl}" style="max-height:200px"  onerror=this.src="/static/mobile/img/empty_img.png"  >
                </a>
            </div>
            {/volist}
        </div>
        <div class="swiper-pagination"></div>
        <script>
            var swiper = new Swiper('.swiper-container', {
                pagination: '.swiper-pagination',
                paginationClickable: true,
                spaceBetween: 30,
                centeredSlides: true,
                autoplay: 2500,
                autoplayDisableOnInteraction: false
            });
        </script>
        <img src="__STATIC__/img/sy-saoyisao.png" class="img1" {if condition="$Think.session.member_id"} onclick="share()" {else/} onclick="jump_login()" {/if}>
        <input type="search" placeholder="搜索关键字" class="search" id="keyword" style="left: 5%;width: 70%;margin-left: 10%;">
        <img src="__STATIC__/img/search.png" class="img2"  style="left: 15%;top: 12%;" onclick="search_goods()" >
        <img src="__STATIC__/img/sy-xiaoxim.png" class="img3" onclick=window.location.href="{:url('mobile/user_info/message_index')}?act=index">
    </div>
    <!--banner结束-->
    <ul class="menu">
        <li><a href="{:url('mobile/Sign/index')}"><img src="__STATIC__/img/sy-lingjifen.png"><br><span id="ceshi111">领积分</span></a></li>
        <li><a href="{:url('mobile/Coupon/index')}?id=-1"><img src="__STATIC__/img/sy-lingquan.png"><br><span>领券</span></a></li>
        <li><a href="{:url('mobile/share_shopping/index')}"><img src="__STATIC__/img/sy-huizhuanqian.png"><br><span>惠赚钱</span></a></li>
        <li><a href="javascript:to_my_wallet();"><img src="__STATIC__/img/sy-zhouzhoubi.png"><br><span>周周币</span></a></li>
        <script>
            //跳转到我的钱包
            function to_my_wallet(){
                sessionStorage.setItem('wallet_index',window.location.href);
                window.location.href = "{:url('mobile/user_info/my_wallet')}";
            }
        </script>
    </ul>
    <div class="hot">
        <div class="pic"><img src="__STATIC__/img/hot.png"></div>
        <div class="swiper_wrap">
            <ul class="font_inner">
                {volist name='hot_spot' id='v'}
                <li>
                    <a href="{:url('mobile/hot_spot/index')}?action_id={$v.id}">{$v.title}</a>
                </li>
                {/volist}
            </ul>
        </div>
        <div class="next">
            <a href="{:url('mobile/hot_spot/index')}"><img src="__STATIC__/img/next.png"></a>
        </div>
    </div>
    <!--限时抢购开始-->
    <div class="sale">
        <h4>限时抢购</h4>
        <div class="time">
            <ul>
                <li><img src="__STATIC__/img/sy-daojishi.png">&#8197;</li>
                <input type="hidden" id="end_time" {if condition="count($limited_list) gt 0"} value="$end_time" {else/} value='0' {/if}>
                <li id="LeftTime" style="width: 80%;"></li>
            </ul>
            <div class="next">
                <a href="{:url('mobile/Limited/index')}"><img src="__STATIC__/img/next.png"></a>
            </div>
        </div>
        {if condition="count($limited_list) gt 0"}
        <div class="swiper-container">
            <ul class="swiper-wrapper">
                {volist name="limited_list" id="v"}
                <li class="swiper-slide">
                    <a href="javascript:jump_goods_details_limit({$v['shop_goods']['id']});">
                        <img src="/{$v['shop_goods']['picUrl']}" style="max-height: 45px;">
                        <span>&yen;{$v['shop_goods']['price']}</span>
                        <!--<p><span>佣金</span><img class="qianbi" style="height: 24px;" src="__STATIC__/img/sy-qianbi.png"><font class="scale">{$v['shop_goods']['rebate_percentage']}%</font></p>-->
                    </a>
                </li>
                {/volist}
            </ul>
            <script>
                $(function () {
                    var swiper = new Swiper('.sale .swiper-container', {
                        slidesPerView: 3.3,
                        spaceBetween: 15,
                        freeMode: true
                    });
                })
            </script>
        </div>
        {/if}
    </div>
    <!--限时抢购结束-->
    <div class="special">
        <div class="left" onclick=window.location.href="{:url('mobile/user_action/day_off_price')}?id=-1" >
            <span><a>团购</a></span>
            <img src="__STATIC__/img/tttj.jpg">
        </div>
        <div class="right">
            <div onclick=window.location.href="{:url('mobile/hot_sale/index')}">
                <span><a>热卖榜</a></span>
                <img src="__STATIC__/img/RMB.jpg">
            </div>
            <div onclick=window.location.href="{:url('mobile/user_action/brand_list')}" >
                <span><a>品牌街</a></span>
                <img src="__STATIC__/img/ppj.jpg">
            </div>
        </div>
    </div>
    <div class="seller">
        <h4>热门市场</h4>
        <a href="{:url('mobile/hot_market/index')}"><img src="__STATIC__/img/next.png" class="next"></a>
    </div>
    <ul class="seller-menu">
        {volist name="hot_list" id='v'}
        <li>
            <a href="{:url('mobile/user_action/market_category')}?type_id={$v.id}">
                <img src="/{$v.picUrl}" onerror=this.src='/static/mobile/img/empty_img.png' ></a>
            <div>
                <h4><a href="{:url('mobile/user_action/market_category')}?type_id={$v.id}">{$v.title}</a></h4>
                <span><a href="{:url('mobile/user_action/market_category')}?type_id={$v.id}">{$v.title}分类</a></span>
            </div>
        </li>
        {/volist}
    </ul>
    <ul class="seller-menu1">
        {volist name='type_list' id='v' offset='0'}
        <li>
            <a href="{:url('mobile/user_action/market_category')}?type_id={$v.id}">
                <h4>{$v.title}</h4>
                <span>{$v.title}分类</span>
                <img src="/{$v.picUrl}" onerror=this.src='/static/mobile/img/empty_img.png' >
            </a>
        </li>
        {/volist}
    </ul>
    <!--发现好店开始-->
    <div class="seller">
        <h4>发现好店</h4>
        <a href="{:url('mobile/user_action/find_gooder')}?type_id=recommend"><img src="__STATIC__/img/next.png" class="next"></a>
    </div>
    <ul class="store" style="width: 100%">
        {volist name='find_shop' id='item'}
        <li>
            <a href="javascript:jump_shop({$item.id});">
                <img src="/{$item.picUrl}"  style="margin: 0 auto;height:76px;width: 49.5%" onerror="this.src='/static/mobile/img/empty_img.png'" >
                <h4>-{$item.title}-</h4>
            </a>
        </li>
        {/volist}
    </ul>
    <!--发现好店结束-->
    <!--猜你喜欢开始-->
    <div class="seller">
        <h4>猜你喜欢</h4>
    </div>
    <ul class="like">
        {volist name='guess_like' id='v'}
        <li>
            <a href="javascript:jump_goods_details({$v.id});">
                <img src="/{$v.thumb_img}" style="height: 78px;" onerror=this.src='/static/mobile/img/empty_img.png' >
                <h4 style="height:30px;">-{:reStrLen($v.title,10)}-</h4>
                <span>&yen;{$v.price}</span>
            </a>
        </li>
        {/volist}
    </ul>
    <!--猜你喜欢结束-->
    <div class="board"></div>
    <div class="board1"></div>
    <div id="shade" class="shade" style="display: none" onclick = "showdiv()">
        <img src="__STATIC__/img/share_bg.png" alt="">
    </div>
    <div class="footer">
        <ul>
            <li>
                <a href="{:url('mobile/Index/index')}">
                    <img src="__STATIC__/img/sy-shouye.png"><br><span class="cur">首页</span>
                </a>
            </li>
            <li>
                <a href="{:url('mobile/GoodsType/index')}?cate_id=recommend">
                    <img src="__STATIC__/img/sy-fenlei.png"><br><span>分类</span>
                </a>
            </li>
            <li>
                <a href="javascript:cart_check();">
                    <img src="__STATIC__/img/sy-cart.png"><br><span>购物车</span>
                </a>
            </li>
            <li>
                <a href="{:url('mobile/information/index')}">
                    <img src="__STATIC__/img/sy-wode.png"><br><span>我的</span>
                </a>
            </li>
        </ul>
    </div>
</div>
<script src="__STATIC__/js/layer_mobile/layer.js"></script>
<!--微信js sdk-->
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<!--<script src="__STATIC__/js/wxHttpsJs.js"></script>-->
<!--分享剪切板-->
<!--<script src="__STATIC__/js/share.js"></script>-->
<script>
    $(window).resize(function() {
        $('.footer').toggle();
    });
    //分享弹出层
    function share(){
        var ua = window.navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i) == 'micromessenger'){
            window.location.href="{:url('mobile/scan_code/qrcode')}?uid={$Think.session.member_id}&act=share";
        }else{
            layer.open({content:'请到微信浏览器内访问本页面',skin:'msg',time:4})
        }

    }
    //跳转到店铺
    function jump_shop(id) {
        var url = "{:url('mobile/user_category/shop_index')}?shop_id="+id;
        sessionStorage.setItem('url_back',window.location.href);
        window.location.href = url;
    }
    //跳转到商品详情
    function jump_goods_details(id){
        sessionStorage.setItem('goods_url_back',window.location.href);
        window.location.href = "{:url('mobile/user_category/goods_details')}?goods_id="+id;
    }
    //限时抢购跳转到商品详情
    function jump_goods_details_limit(id){
        sessionStorage.setItem('goods_url_back',window.location.href);
        window.location.href = "{:url('mobile/user_category/goods_details')}?goods_id="+id+"&limit_status";
    }
    //未登录跳转到登录
    function jump_login(){
        layer.open({
            content: '您还未登录,请登录'
            ,btn: ['去登录', '取消']
            ,yes: function(index){
                window.location.href="{:url('mobile/user_port/login')}";
                layer.close(index);
            }
        });
    }
    function cart_check(){
        if ('{$Think.session.member_id}'){
            window.location.href="{:url('mobile/user_cart/cart_index')}";
        }else{
            jump_login();
        }
    }
    //关键词搜索
    function search_goods(){
        var search = $('#keyword').val();
        sessionStorage.setItem('search_back_url',window.location.href);
        window.location.href = "{:url('mobile/user_category/search_goods')}?type=0&search="+search;
    }
    //倒计时效果js代码
    function checktime(i) {
        if (i < 10) {
            i = "0" + i;

        }
        else {
            i = i;
        }
        return i;
    }
    function freshTime() {
        var endtime = new Date($('#end_time').val());
        var nowtime = new Date();
        var lefttime = parseInt(endtime.getTime() - nowtime.getTime());//这是毫秒，如果再/1000就是秒
        // 获取剩下的日、小时、分钟、秒钟
        // 一天有多少毫秒，一小时有多少毫秒，一分钟有多少毫秒，一秒钟有多少毫秒
        var dm = 24 * 60 * 60 * 1000;
        var d = parseInt(lefttime / dm);
        var hm = 60 * 60 * 1000;
        var h = parseInt((lefttime / hm) % 24);
        var mm = 60 * 1000;
        var m = parseInt((lefttime / mm) % 60);
        var s = parseInt((lefttime / 1000) % 60);
        m = checktime(m);
        s = checktime(s);

        document.getElementById('LeftTime').innerHTML =
                "&#8197;<span style='width: 10px;'>" + d + "</span>" +
                "&#8197;天" +
                "&#8197;<span style='width: 10px;'>" + h + "</span>" +
                "&#8197;小时&#" +
                "8197;<span style='width: 10px;'>" + m + "</span>&#" +
                "8197;分钟&" +
                "#8197;<span style='width: 10px;'>" + s + "</span>&" +
                "#8197;秒&#8197;";
        if (lefttime < 0) {
            document.getElementById('LeftTime').innerHTML = "团购活动已经结束！";
        }
    }

    freshTime();
    var sh;
    sh = setInterval('freshTime()', 1000)
</script>
<!-- WPA start -->
<!--<script src="//wp.qiye.qq.com/qidian/2852139184/7140ae18d6960f22ba45476e11937fbc" charset="utf-8"></script>-->
<!-- WPA end -->
<!-- WPA start -->

<!-- WPA end -->
<script src="//wp.qiye.qq.com/qidian/2852139184/b3fe1f16a60911a5d0d8f52c68a2856a" charset="utf-8"></script>

<script>

    function test(){
        var iframeDoc=document.getElementById("qidian_wpa_2852139184_29");
//        console.log(iframeDoc);
        iframeDoc.style.bottom = '100px';
    }
</script>
</body>
</html>